import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:super_person_app/components/cache_widget.dart';
import 'package:super_person_app/constants/colors.dart';
import 'package:super_person_app/pages/find/widget/citywide.dart';
import 'package:super_person_app/pages/find/widget/recommend.dart';
import 'package:super_person_app/pages/find/widget/videos.dart';

import 'find_logic.dart';

class FindPage extends StatelessWidget {
  const FindPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final logic = Get.find<FindLogic>();
    final state = Get.find<FindLogic>().state;

    return CacheWidget(
      child: SafeArea(
        child: Scaffold(
          appBar: AppBar(
            centerTitle: true,
            elevation: 0,
            backgroundColor: Colors.white,
            title: FractionallySizedBox(
              widthFactor: 0.6,
              child: SizedBox(
                height: 46.h,
                child: TabBar(
                  controller: logic.state.tabController.value,
                  tabs: const [
                    Text("推荐"),
                    Text("同城"),
                    Text("视频"),
                  ],
                  indicatorSize: TabBarIndicatorSize.label,
                  indicatorColor: BasicColor.mainColor,
                  indicatorWeight: 2.h,
                  indicatorPadding: EdgeInsets.only(
                    left: 6.w,
                    right: 6.w,
                  ),
                  labelStyle: TextStyle(fontSize:16.sp, fontWeight: FontWeight.w600),
                  unselectedLabelStyle: TextStyle(fontSize: 16.sp, fontWeight: FontWeight.w600),
                  labelColor: BasicColor.mainColor,
                  unselectedLabelColor: const Color(0xff403F42),
                ),
              ),
            ),
          ),
          body: TabBarView(
            controller: logic.state.tabController.value,
            children: const [
              RecommendPage(),
              CitywidePage(),
              VideosPage(),
            ],
          ),
        ),
      ),
    );
  }
}
